package com.hetao.jmb2c.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {
    @Bean
    public RestTemplate restTemplate() {
        // 生产环境应该配置连接池和超时
        // ClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
        // ((HttpComponentsClientHttpRequestFactory)factory).setConnectTimeout(5000);
        // return new RestTemplate(factory);
        
        return new RestTemplate();
    }
}
